<!--
* @description 
* @fileName selCian.vue
* @author huangyu
* @date 2023/03/20 16:29:47
!-->
<template>
    <el-cascader
        v-model="value"
        :options="cianList"
        filterable
        :props="{ checkStrictly: true,value:'_id',label:'name' }"
        @change="handleChange"></el-cascader>
</template>

<script>
import { get } from '@/common/app.js'
export default {
    components: {
    },
    model: {
        prop: "value",
        event: "change"
    },
    props: {
        value: Array
    },
    data() {
        return {
            values: [],
            cianList: [],
        }
    },
    mounted() {
        this.getCianData()
    },
    methods: {
        getCianData() {
            let params = {
                type: "getGameCian",
                data: {}
            }
            get('game', params).then(res => {
                if (res) {
                    this.cianList = res.data
                    if(this.cianList){
                        this.cianList.forEach(item=>{
                            item.name = item.cianName
                            if(item.children){
                                item.children.forEach(obj=>{
                                    obj.name = obj.houseName
                                })
                            }
                        })
                    }
                }
            })
        },
        handleChange(valueArr){
            this.$emit("change", valueArr);
            // this.$emit("handleChange",valueArr)
        },
    },
}
</script>

<style scoped></style>